<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>

    <body>
        <h1>Seasons</h1>

        <table class="default"> 
            <tr>
                <th>Name</th>
                <th>From - to</th>
                <th>Detail</th>
                    <c:if test='<%= (Boolean.parseBoolean(session.getAttribute("isAdmin").toString()))%>' >
                    <th>Edit</th>
                    <th>Remove</th>
                    </c:if>
            </tr>
            <c:forEach  items="${seasons}" var="season">
                <tr>
                    <td><a href="<c:url value="/admin/season/detail?id=${season.id}" />"><c:out value="${season.name}"/></a></td>
                    <td><c:out value="${season.startDate}"/> - <c:out value="${season.endDate}"/></td>
                    <td><a href="<c:url value="/admin/season/detail?id=${season.id}" />"><img src="<c:url value="/resources/img/detail-icon.png" />" width="16" height="16" alt="detail" /></a></td>
                            <c:if test='<%= (Boolean.parseBoolean(session.getAttribute("isAdmin").toString()))%>' >
                        <td><a href="<c:url value="/admin/season/edit?id=${season.id}" />"><img src="<c:url value="/resources/img/edit-icon.gif" />" width="16" height="16" alt="edit" /></td>
                        <td class="last"><a href="<c:url value="/admin/season/remove?id=${season.id}" />"><img src="<c:url value="/resources/img/remove-icon.gif" />" width="16" height="16" alt="remove" /></td>
                            </c:if>
                </tr>
            </c:forEach>
        </table>
        <br />

        <c:if test='<%= (Boolean.parseBoolean(session.getAttribute("isAdmin").toString()))%>' >
            <div class="buttons">
                <a href="<c:url value="/admin/season/edit?id=-1" />" class="button add">Add a new season</a>
            </div>
        </c:if>
    </body>
</html>